package com.wbl.train.common.member.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;
import lombok.Data;
import lombok.experimental.Accessors;

/**
 * @author 王博纶
 * @since 2023-12-19
 * @description 会员
 */
@Data
@Accessors(chain = true) // 开启链式语法
@TableName("member") // 设置实体的别名 --- 否则使用mybatisPlus查询的时候会报错
@Schema(name = "Member 对象", description = "会员 实体类")
public class MemberEntity {

    @Schema(description = "id")
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    @Schema(description = "手机号")
    @Pattern(regexp = "^1\\d{10}$",message = "手机号格式错误")
    @NotBlank(message = "[手机号不能为空]")
    private String mobile;


}
